<template>
  <!-- 协议 -->
  <Top-Page class="agreement-box">
    <NavBar :title="title" leftArrow @click-left="navBack()" />

    <SoftwareLicensing v-if="id === 0" />
    <PrivacyProtection v-if="id === 1" />
    <ProtocolOfUsage v-if="id === 2" />
    <ChildrensPrivacy v-if="id === 3" />
    <ServiceAgreement v-if="id === 4" />
  </Top-Page>
</template>

<script>
import NavBar from '@/components/NavBar/NavBar.vue';
import { navBack } from '@/utils/utils.js';
import SoftwareLicensing from './src/software_licensing.vue';
import PrivacyProtection from './src/privacy_protection.vue';
import ProtocolOfUsage from './src/protocol_of_usage.vue';
import ChildrensPrivacy from './src/childrens_privacy.vue';
import ServiceAgreement from './src/service_agreement';

export default {
  data() {
    return {
      navBack,
      title: '',
      id: -1
    };
  },
  components: { NavBar, SoftwareLicensing, PrivacyProtection, ProtocolOfUsage, ChildrensPrivacy, ServiceAgreement },
  onLoad(options) {
    const id = Number(options.id);
    this.id = id;
    this.title =
      id === 0
        ? '畅了软件许可及服务协议'
        : id === 1
        ? '畅了隐私保护指引'
        : id == 2
        ? '畅了个人账号使用规范'
        : id === 3
        ? '儿童隐私保护声明'
        : '服务协议';
  }
};
</script>

<style lang="scss" scoped>
.agreement-box {
  padding: calc(var(--amplified_base) * 120rpx) 20rpx 120rpx;
  text-indent: 2em;
  min-height: 100vh;
  background-color: #fff;
  font-size: calc(var(--amplified_base) * 28rpx);
}
</style>
